package cn.kgc.interceptor;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * @author wangyue
 * @version 1.0
 */
@Configuration
public class JwtInterceptorConfig implements WebMvcConfigurer {

    @Resource
    private JwtInterceptor jwtInterceptor;

    /**
     * 添加拦截器
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //用户访问控制器的所有请求都使用jwtInterceptor拦截器进行拦截
        registry.addInterceptor(jwtInterceptor).addPathPatterns("/**");
    }
}
